<script setup>
import { useRouter } from "vue-router";
import { onMounted, ref } from "vue";
const router = useRouter();
const flag = localStorage.getItem("status_login");
const token = localStorage.getItem("token");
const status = ref(false);
const BackLogin = () => {
  localStorage.removeItem("token");
  localStorage.removeItem("user_name");
  localStorage.removeItem("user_nick");
  localStorage.removeItem("real_name");
  localStorage.removeItem("status_login");
  localStorage.removeItem('sms_code')

  router.push('/login')
};
onMounted(() => {
  if (flag == 1) {
    status.value = true;
  } else {
    status.value = false;
  }
});
</script>
<template>
  <div>
    <van-nav-bar title="设置" left-arrow @click-left="router.go(-1)" />
    <van-cell title="更换绑定手机号" is-link value="内容" />

    <van-cell title="设置密码" is-link />
    <van-cell title="关于我们" is-link />
    <van-cell title="上课短信通知" is-link>
      <template #right-icon>
        <van-switch
          v-model="status"
          active-color="#ee0a24"
          inactive-color="#dcdee0"
        />
      </template>
    </van-cell>
    <van-button type="danger" size="large" v-show="token" @click="BackLogin"
      >退出登录</van-button
    >
  </div>
</template>

<style scoped></style>
